机器学习算法KNN
k-近邻算法:
- 最容易理解的算法
- 最容易实现的算法
数据分析数据可视化Pyecharts
点击我查看效果
1 | from pyecharts import options as opts |
<div id="483573e30f2f416da05811d91f667a50" style="width:900px; height:500px;"></div>
1 | from pyecharts import options as opts |
1 | barh = bar_reversal_axis() |
<div id="fdc5d30829da4fca9687d275cfc80101" style="width:900px; height:500px;"></div>
1 | #可以用工具箱将柱形转换为折线,或者直接修改名称 |
<div id="8b01a8f8d42249c0a0225af6e160f0dd" style="width:900px; height:500px;"></div>
1 | from pyecharts.charts import Scatter |
<div id="34892aa5965b4c6da5ccc50700698d7f" style="width:900px; height:500px;"></div>
散点图数据支持series类型
1 | from pyecharts import options as opts |
<div id="8d0a1536a9d24abe88f3c6977b6f4157" style="width:900px; height:500px;"></div>
1 | from pyecharts import options as opts |
<div id="6041731010b84d54b150ab399ebc991a" style="width:900px; height:500px;"></div>
1 | for i in zip(['a','b','c'],[1,2,3]): |
('a', 1)
('b', 2)
('c', 3)
1 | from pyecharts.charts import WordCloud |
<div id="a02363d660c4424f8d9ae310355913cc" style="width:900px; height:500px;"></div>
1 | import jieba |
1 | text = '7月17日以来,河南省遭遇极端强降雨,中西部、西北部地区出现成片大暴雨,部分地区特大暴雨。根据《国家防汛抗旱应急预案》有关规定,国家防总决定于7月20日20时启动防汛Ⅲ级应急响应。 河南因为暴雨路面出现大规模积水,多名人员被困,全国各地的人民都在关心河南暴雨情况,希望他们平安度过这关。为帮助河南因强降雨受困群众,九派新闻记者陆续搜集河南各地求助信息并进行电话求证核实,并将核实到的信息滚动发布于此条评论区。如您或者家人受困需发布求助信息,可直接在此条置顶内容评论区留言,或直接联系微信号XXXX。请有力量施予援手的你,积极转发扩散' |
array(['7', '月', '17', '日', '以来', ',', '河南省', '遭遇', '极端', '强降雨', ',',
'中西部', '、', '西北部', '地区', '出现', '成片', '大暴雨', ',', '部分', '地区', '特',
'大暴雨', '。', '根据', '《', '国家', '防汛', '抗旱', '应急', '预案', '》', '有关',
'规定', ',', '国家', '防总', '决定', '于', '7', '月', '20', '日', '20', '时',
'启动', '防汛', 'Ⅲ', '级', '应急', '响应', '。', ' ', '河南', '因为', '暴雨', '路面',
'出现', '大规模', '积水', ',', '多名', '人员', '被困', ',', '全国', '各地', '的',
'人民', '都', '在', '关心', '河南', '暴雨', '情况', ',', '希望', '他们', '平安',
'度过', '这关', '。', '为', '帮助', '河南', '因', '强降雨', '受困', '群众', ',',
'九派', '新闻记者', '陆续', '搜集', '河南', '各地', '求助', '信息', '并', '进行', '电话',
'求证', '核实', ',', '并', '将', '核实', '到', '的', '信息', '滚动', '发布', '于',
'此条', '评论', '区', '。', '如', '您', '或者', '家人', '受困', '需', '发布', '求助',
'信息', ',', '可', '直接', '在', '此条', '置顶', '内容', '评论', '区', '留言', ',',
'或', '直接', '联系', '微', '信号', 'XXXX', '。', '请', '有', '力量', '施予',
'援手', '的', '你', ',', '积极', '转发', '扩散'], dtype='<U4')
1 | np.unique(arr,return_counts=True) #统计计算词语 |
(array([' ', '17', '20', '7', 'XXXX', 'Ⅲ', '、', '。', '《', '》', '中西部', '为',
'九派', '于', '人员', '人民', '他们', '以来', '你', '信号', '信息', '全国', '关心',
'内容', '决定', '出现', '到', '力量', '区', '发布', '受困', '可', '各地', '启动',
'响应', '因', '因为', '国家', '在', '地区', '多名', '大暴雨', '大规模', '如', '家人',
'将', '希望', '帮助', '平安', '并', '应急', '度过', '强降雨', '微', '您', '情况',
'成片', '或', '或者', '扩散', '抗旱', '援手', '搜集', '新闻记者', '施予', '日', '时',
'暴雨', '月', '有', '有关', '极端', '核实', '根据', '此条', '求助', '求证', '河南',
'河南省', '滚动', '特', '电话', '留言', '的', '直接', '积极', '积水', '级', '置顶',
'群众', '联系', '被困', '西北部', '规定', '评论', '请', '路面', '转发', '这关', '进行',
'遭遇', '部分', '都', '防总', '防汛', '陆续', '需', '预案', ','], dtype='<U4'),
array([ 1, 1, 2, 2, 1, 1, 1, 5, 1, 1, 1, 1, 1, 2, 1, 1, 1,
1, 1, 1, 3, 1, 1, 1, 1, 2, 1, 1, 2, 2, 2, 1, 2, 1,
1, 1, 1, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2,
1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2,
2, 1, 1, 1, 2, 1, 2, 2, 1, 4, 1, 1, 1, 1, 1, 3, 2,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
1, 1, 2, 1, 1, 1, 12], dtype=int64))
1 | [list(z) for z in zip(Faker.provinces, Faker.values())] |
[['广东', 44],
['北京', 24],
['上海', 135],
['江西', 25],
['湖南', 109],
['浙江', 61],
['江苏', 20]]
1 | from pyecharts import options as opts |
<div id="1e35a634ad934e24be75def22a3ca053" style="width:900px; height:500px;"></div>
1 | from pyecharts import options as opts |
<div id="8674fac4fa7549b09bc2fb3c52b13a24" style="width:900px; height:500px;"></div>
1 | import math |
<div id="7d91a1ebb5be4a56960ecf5e78dfa703" style="width:900px; height:500px;"></div>
1 | import pyecharts.options as opts |
<div id="286cf24d686747b0be126ef08292eaef" style="width:1600px; height:800px;"></div>
1 | from pyecharts import options as opts |
<div id="b1272803e07c4ca380d531d2f6309fcf" style="width:900px; height:500px;"></div>
1 | from pyecharts import options as opts |
1 | grid.render_notebook() |
<div id="2b97e72a738d452eb0c8940456b653cb" style="width:900px; height:900px;"></div>
1 | from pyecharts import options as opts |
1 | page.render_notebook() |
<div id="199ff42a508d44f6ad14a1d74408c399" style="width:900px; height:500px;"></div>
<div id="f5cb6a87a462408c9727b8f9c49ce892" style="width:900px; height:500px;"></div>
1 | from pyecharts import options as opts |
1 | tab.render_notebook() #组件选项卡 |
<div id="bacaaeb1f73d409e9d08ae0162754f93" class="chart-container" style="width:900px; height:500px;"></div>
<div id="9950ad587efa42a69f96398587262ac4" class="chart-container" style="width:900px; height:500px;"></div>
1 | from pyecharts import options as opts |
<div id="b75cabdfb8c74bb090e8526962ae8347" style="width:900px; height:500px;"></div>
在ppt中插入Pyecharts图表
https://www.cnblogs.com/mark-wq/p/14168535.html
html要改ie内核:
加上:< meta http-equiv=”X-UA-Compatible” content=”IE=EmulateIE10”/>
数据分析数据可视化Matplotlib
1 | import numpy as np |
1 | import matplotlib.pyplot as plt |